import Vue from 'vue';
import Router from 'vue-router';

Vue.use(Router);

const Recommend = (resolve) => {
    import('comp/recommend/recommend').then((module) => {
        resolve(module);
    });
};
const Disc = (resolve) => {
    import('comp/disc/disc').then((module) => {
        resolve(module);
    });
};
const Singer = (resolve) => {
    import('comp/singer/singer').then((module) => {
        resolve(module);
    });
};
const SingerDetail = (resolve) => {
    import('comp/singer-detail/singer-detail').then((module) => {
        resolve(module);
    });
};
const Search = (resolve) => {
    import('comp/search/search').then((module) => {
        resolve(module);
    });
};
const Rank = (resolve) => {
    import('comp/rank/rank').then((module) => {
        resolve(module);
    });
};
const Toplist = (resolve) => {
    import('comp/top-list/toplist').then((module) => {
        resolve(module);
    });
};
const UserCenter = (resolve) => {
    import('comp/user-center/user-center').then((module) => {
        resolve(module);
    });
};
export default new Router({
  routes: [
    {
      path: '/',
      redirect: '/recommend',
    },
    {
      path: '/recommend',
      component: Recommend,
      children: [
        {
          path: ':id',
          component: Disc,
        },
      ],
    },
    {
      path: '/singer',
      component: Singer,
      children: [
        {
          path: ':id',
          component: SingerDetail,
        },
      ],
    },
    {
      path: '/search',
      component: Search,
      children: [
        {
          path: ':id',
          component: SingerDetail,
        },
      ],
    },
    {
      path: '/rank',
      component: Rank,
      children: [
        {
          path: ':id',
          component: Toplist,
        },
      ],
    },
    {
       path: '/user',
       component: UserCenter,
    },
  ],
});
